package light.head.dao.mobile;


import java.util.ArrayList;
import java.util.List;

import light.head.framework.base.BaseDAO;
import light.head.model.Album;

import org.springframework.stereotype.Service;


@Service
public class MobileAlbumDAO extends BaseDAO<Album, Integer> {
	
//	public RESULT findByMap(Integer oc, Map<String, String> map, PageBean pb) {
//		
//		if (null == oc) return null;
//		
//		StringBuffer hql = new StringBuffer("FROM Album a WHERE a.oc = ?");
//		
//		List<Object> parm = new ArrayList<Object>();
//		
//		if (null != map) {
//			
//			String st = map.get(Parm.ST);
//			String et = map.get(Parm.ET);
//			
//		}
//		return null;
//	}
	
	/**
	 * 通过机构编号集合获取所有的相册
	 *@param ocs	机构编号集合
	 *@author yangguanghe [2014-5-27_下午5:29:48]
	 */
	public List<Album> findByOcs(List<Integer> ocs) {
		if (null == ocs || ocs.size() == 0) return null;
		
		StringBuffer hql = new StringBuffer("FROM Album a WHERE a.oc IN (");
		List<Object> parm = new ArrayList<Object>();
		for (Integer i : ocs) {
			if (null == i) continue;
			hql.append("?,");
			parm.add(i);
		}
		hql.deleteCharAt(hql.length() - 1).append(")");
		return find(hql.toString(), parm.toArray());
	}
	
	
	

}
